package com.dev1.pack01web.Controller;

import com.dev1.pack01web.bean.Province;
import com.dev1.pack02service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;


@RestController
@CrossOrigin
public class TestJsonController2 {

    @Autowired
    private ProvinceService service;
    @GetMapping("/test3")
    public List<Province> getProvinces3(){
        List<Province> list = null;
        list = service.findAllProvinces();
        System.out.println("---getProvinces3--"+list);
        return list;
    }

    @GetMapping("/update1")
    public String update1(String name){
        service.addNums(name,1);
        return "更新成功";
    }

}